package com.itheima.mysystem;

import java.lang.reflect.Array;
import java.util.Arrays;

public class demo4 {
    public static void main(String[] args) {
        int[] arr1 = {1, 2, 3, 4, 5};
        int[] arr2 = new int[8];

        /*//需求1: 把arr1中的数据全部拷贝到arr2中.
        System.arraycopy(arr1, 0, arr2, 0, arr1.length);
        for (int i = 0; i < arr2.length; i++) {
           System.out.println(arr2[i]);
        }*/

        //需求2: 把arr1中的数据2,3,4拷贝到arr2中的3,4,5索引位置
        System.arraycopy(arr1,1,arr2,3,3);
        System.out.println(Arrays.toString(arr2));
    }
}
